<template>
    <div>
        <el-card class="box-card">
            <div class="app-container">
                <div class="container-header">
                    <div class="hign-line"></div>
                    <div class="header-left">
                        {{$t('inventoryManagement.baseInfo')}}
                    </div>
                </div>
                <el-descriptions class="margin-top" :column="3" size="small" border>
                    <el-descriptions-item>
                        <template slot="label">
                            {{$t('inventoryManagement.supplierBatchNo')}}
                        </template>
                        {{viewModel.lichn}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            {{$t('inventoryManagement.supplierNo')}}
                        </template>
                        {{viewModel.supplierCode}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            {{$t('inventoryManagement.batchQuantity')}}
                        </template>
                        {{viewModel.batchAmount}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            {{$t('inventoryManagement.materialName')}}
                        </template>
                        {{viewModel.materialName}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            {{$t('inventoryManagement.materialNo')}}
                        </template>
                        {{viewModel.materialCode}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            {{$t('inventoryManagement.maturity')}}
                        </template>
                        {{viewModel.maturity}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            {{$t('inventoryManagement.batch')}}
                        </template>
                        {{viewModel.lot}}
                    </el-descriptions-item>

                </el-descriptions>
                <!-- <el-form :model="queryParams" ref="queryForm" v-show="showSearch" label-width="88px">
                    <el-row :gutter="24" class="mb8">
                        <el-col :span="8">
                            <el-form-item :label="$t('inventoryManagement.supplierBatchNo')" prop="supplierBatchNo">
                                {{viewModel.lichn}}
                            </el-form-item>
                        </el-col>

                        <el-col :span="8">
                            <el-form-item :label="$t('inventoryManagement.supplierNo')" prop="supplierNo">
                                {{viewModel.supplierCode}}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item :label="$t('inventoryManagement.batchQuantity')" prop="batchQuantity">
                                {{viewModel.batchAmount}}
                            </el-form-item>
                        </el-col>

                        <el-col :span="8">
                            <el-form-item :label="$t('inventoryManagement.materialName')" prop="materialName">
                                {{viewModel.materialName}}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item :label="$t('inventoryManagement.materialNo')" prop="materialNo">
                                {{viewModel.materialCode}}
                            </el-form-item>
                        </el-col>

                        <el-col :span="8">
                            <el-form-item :label="$t('inventoryManagement.maturity')" prop="maturity">
                                {{viewModel.maturity}}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item :label="$t('inventoryManagement.batch')" prop="batch">
                                {{viewModel.lot}}
                            </el-form-item>
                        </el-col>

                    </el-row>

                </el-form> -->
                <div class="container-header">
                    <div class="hign-line"></div>
                    <div class="header-left">
                        {{$t('inventoryManagement.inspectionInfo')}}
                    </div>
                </div>
                <div class="container-table">
                    <el-table max-height="350" border stripe v-loading="loading" :data="viewModel.classList">
                        <el-table-column :label="$t('inventoryManagement.inspectionItems')" align="left" prop="projectName" minWidth="160" />
                        <el-table-column :label="$t('inventoryManagement.code')" align="left" prop="projectCode" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.inspectionTypeUnit')" minWidth="130" prop="unitName" align="left" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.inspectionType')" minWidth="130" align="left" prop="inspectionType" />
                        <el-table-column :label="$t('inventoryManagement.frequency')" minWidth="110" align="left" prop="itemFrequency" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.frequencyValue')" align="left" prop="itemFrequencyValue" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.targetValue')" align="left" prop="targetValue" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.lowerValue')" align="left" prop="lowerLimit" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.upperValue')" align="center" prop="upperLimit" />
                        <el-table-column :label="$t('inventoryManagement.samplingScheme')" align="left" prop="samplingOne" minWidth="140" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.samplingOptions')" align="left" prop="samplingTwo" minWidth="200">
                            <template slot-scope="scope">
                                {{scope.row.samplingTwo}}<span v-if="scope.row.samplingOne==='百分比'">%</span> {{scope.row.samplingThree}}
                            </template>
                        </el-table-column>
                        <el-table-column :label="$t('inventoryManagement.testMethod')" align="left" prop="testMethod" minWidth="140" :show-overflow-tooltip="true">
                            <template slot-scope="scope">
                                {{scope.row.detectionOne}} {{scope.row.detectionTwo}}
                            </template>
                        </el-table-column>
                        <el-table-column :label="$t('inventoryManagement.specialCharacteristics')" align="left" prop="symbol" minWidth="110" :show-overflow-tooltip="true" />
                        <el-table-column :label="$t('inventoryManagement.decimalPlaces')" align="left" prop="decimalPlace" :show-overflow-tooltip="true" />
                    </el-table>
                </div>
            </div>
        </el-card>
        <div class="submit-footer">
            <el-button icon="el-icon-close" size="small" @click="closeTab" class="drawer-close">{{$t('public.close')}}</el-button>
        </div>
    </div>

</template>

<script>
import { getUnqualifiedById } from '@/api/inventoryManagement/inspectedInventory'
import FileUploadInput from '@/components/FileUploadInput'
export default {
    name: 'inspectionExemption',
    dicts: ['sys_normal_disable'],
    components: {
        FileUploadInput,
    },
    data() {
        return {
            direction: 'rtl',
            addInspectionExemption: false,
            drawer: false,
            approvalOpen: false,
            viewModel: {},
            viewInspectionExemption: false,
            inspectionOptions: [
                {
                    value: '1',
                    label: '检验项1',
                },
                {
                    value: '2',
                    label: '检验项2',
                },
            ],
            inspectionTypeUnitOptions: [
                {
                    value: '1',
                    label: '单位1',
                },
                {
                    value: '2',
                    label: '单位2',
                },
            ],
            frequencyOptions: [
                {
                    value: '1',
                    label: '批',
                },
                {
                    value: '2',
                    label: '件',
                },
                {
                    value: '3',
                    label: '年',
                },
                {
                    value: '4',
                    label: '季',
                },
                {
                    value: '5',
                    label: '月',
                },
            ],
            samplingSchemeOptions: [
                {
                    value: '1',
                    label: 'GB/T2828.1-2012',
                },
                {
                    value: '2',
                    label: '百分比',
                },
                {
                    value: '3',
                    label: '固定抽样',
                },
                {
                    value: '4',
                    label: 'C=0',
                },
            ],
            testMethodOptions: [
                {
                    value: '1',
                    label: '目测',
                },
                {
                    value: '2',
                    label: '量具',
                },
                {
                    value: '3',
                    label: '验证',
                },
            ],
            samplingLevelOptions: [
                {
                    value: '1',
                    label: 'S-1',
                },
                {
                    value: '2',
                    label: 'S-2',
                },
                {
                    value: '3',
                    label: 'S-3',
                },
                {
                    value: '4',
                    label: 'S-4',
                },
            ],
            samplingLevelTypeOptions: [
                {
                    value: '1',
                    label: '正常',
                },
                {
                    value: '2',
                    label: '放宽',
                },
                {
                    value: '3',
                    label: '加严',
                },
            ],
            samplingFixedTypeOptions: [
                {
                    value: '1',
                    label: '批',
                },
                {
                    value: '2',
                    label: '件',
                },
            ],
            specialCharacteristicsOptions: [
                {
                    value: '1',
                    label: 'CC',
                },
                {
                    value: '2',
                    label: 'SC',
                },
            ],
            addModel: {},
            viewModel: {
                file: 'xxx.jpeg',
            },
            editModel: {},
            approvalForm: {
                status: '1',
                textarea: '',
            },
            selBtn: 1,
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 字典表格数据
            typeList: [],
            // 弹出层标题
            title: '',
            // 是否显示弹出层
            open: false,
            // 日期范围
            dateRange: [],
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                noticeTitle: undefined,
                noticeType: undefined,
                hasRead: undefined,
                createTime: undefined,
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
                materialName: [
                    {
                        required: true,
                        message: this.$t('formValidation.materialNameCannotBeEmpty'),
                        trigger: 'blur',
                    },
                ],
                materialNo: [
                    {
                        required: true,
                        message: '物料编号不能为空',
                        trigger: 'blur',
                    },
                ],
                supplierNo: [
                    {
                        required: true,
                        message: '供应商编号不能为空',
                        trigger: 'blur',
                    },
                ],
            },
            fullscreen: false,
        }
    },
    created() {
        this.id = this.$route.params.id
        this.getDetail()
    },
    methods: {
        closeTab() {
            this.$router.push({
                path: '/inventoryManagement/reviewUnqualified',
            })
        },

        getDetail() {
            this.loading = true
            getUnqualifiedById(this.id).then((response) => {
                if (response.code == 200 && response.data) {
                    this.viewModel = response.data
                    this.loading = false
                }
            })
        },
    },
}
</script>
<style lang="scss" scoped>
::v-deep .el-card {
    padding-top: 20px;
    border: 0px;
    box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    padding-bottom: 20px;
}
::v-deep .el-aside {
    padding: 0;
    margin-bottom: 0;
}
.content-style {
    border: 0px;
    box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    background-color: white;
    margin-top: 10px;
}
::v-deep .el-button-group .selBtn {
    background: #fff;
    border: 1px solid #0b7be3;
    color: #0b7be3;
}
::v-deep .el-button-group .unselBtn {
    background: #fff;
    border: 1px solid #ededf2;
    color: #666666;
}
.header-left {
    float: left;
    font-size: 14px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #333333;
    line-height: 40px;
    display: flex;
    justify-content: center;
}
.header-right {
    float: right;
}
.container-header {
    float: left;
    width: 100%;
    border-bottom: 1px solid #ededf2;
    padding-left: 12px;
}
.container-table {
    float: left;
    margin-top: 6px;
    width: 100%;
    //   max-height: calc(100vh - 600px);
    overflow: auto;
}
.mb8 {
    float: left;
    margin-top: 6px;
    width: 100%;
}
.drawer-footer {
    display: flex;
    position: relative;
    z-index: 9999;
    bottom: -40px;
    height: 40px;
    justify-content: center;
    width: 100%;
}
.hign-line {
    position: relative;
    left: -8px;
    top: 14px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #0b7be3;
    float: left;
}
.drawer-close {
    background: #f7f8fa;
    border-color: #f7f8fa;
}
.submit-footer {
    height: 52px;
    background: #ffffff;
    box-shadow: 0px -5px 5px 0px rgba(0, 0, 0, 0.08);
    border-radius: 4px 4px 0px 0px;
    position: fixed;
    z-index: 9;
    bottom: 0px;
    width: 100%;
    left: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.samplingPercent {
    position: absolute;
    z-index: 9;
    right: 20px;
}
::v-deep .el-card {
    padding-top: 0px;
    max-height: calc(100vh - 200px);
    overflow: auto;
}
::v-deep .el-form-item__label {
    font-weight: 400;
    color: #999999;
}
.margin-top {
    margin-top: 5px;
    float: left;
    width: 100%;
}
</style>
